<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>外边距自动合并</title>
    <style type="text/css">
        .one{
            width:300px;
            height:300px;
        }
        .two{
            width:100px;
            height:100px;
        }
        .one{
            background-color: red;
            margin-top:30px;
        }
        .two{
            background-color: green;
            margin-top:50px;
        }
    </style>
</head>
<body>
    <div class="one">
        <div class="two"></div>
    </div>
</body>
</html>